package com.ruoyi.worklog.service;

import com.ruoyi.worklog.domain.WlLeaderMember;
import com.ruoyi.worklog.mapper.WlLeaderMemberMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author cw
 * @Date 2022/7/22 - 07 - 22
 * @Description com.ruoyi.worklog.service
 */
@Service
public class WlLeaderMemberServiceImpl implements WlLeaderMemberService {

    @Autowired
    private WlLeaderMemberMapper wlLeaderMemberMapper;

    //通过组长 查 组员
    @Override
    public List<Long> selectMembers(Long leader_id){
        return wlLeaderMemberMapper.selectMembers(leader_id);
    }

    //通过 组员 查组长
    @Override
    public List<Long> selectLeader(Long member_id){
        return wlLeaderMemberMapper.selectLeader(member_id);
    }

    //插入
    @Override
    public int insertLeaderMember(WlLeaderMember wl_leader_member){
        return wlLeaderMemberMapper.insertLeaderMember(wl_leader_member);
    }

    //删除
    @Override
    public int deleteLeaderMember(@Param("leader_id") long leader_id, @Param("member_id") long member_id){
        return wlLeaderMemberMapper.deleteLeaderMember(leader_id,member_id);
    }

    //通过删除ledaerid，则所有关系都删除
    @Override
    public int deleteLeaderMemberByLeader(@Param("leader_id") long leader_id){
        return wlLeaderMemberMapper.deleteLeaderMemberByLeader(leader_id);
    }

    //
    @Override
    public int deleteLeaderMemberByMember(@Param("member_id") long member_id){
        return wlLeaderMemberMapper.deleteLeaderMemberByMember(member_id);
    }
    public int countLeaderMember(long leader_id,long member_id){
        return wlLeaderMemberMapper.countLeaderMember(leader_id,member_id);
    }
}
